package com.wn32.main.demo5;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.stream.Collectors;

public class Main {
    public static void main(String[] args) {
        List<Hero> list = new CopyOnWriteArrayList<Hero>();
        list.add(new Hero(1, "亚瑟", "肉", 0));
        list.add(new Hero(2, "安琪拉", "法", 0));
        list.add(new Hero(3, "诸葛亮", "法", 18800));
        list.add(new Hero(4, "鲁班", "射", 18800));
        list.add(new Hero(5, "姜子牙", "法", 5880));
        list.add(new Hero(6, "铠", "肉", 18800));
        list.add(new Hero(7, "百里守约", "射", 18800));
        list.add(new Hero(8, "庄周", "肉", 5880));
        list.add(new Hero(9, "澜", "刺", 18800));

        for (int i = 0; i < list.size(); i++) {
            if(list.get(i).getType().equals("法")){
                list.remove(i);
            }
        }

        for (Hero hero : list) {
            if(hero.getType().equals("法")){
                list.remove(hero);
            }
        }
        list.forEach(System.out::println);
    }
}
